// JavaScript Document
mlaprofile = jQuery.noConflict();
mlaprofile().ready(function() {
					
                    mlaprofile("#mlaprofile-node-form").validate({
													  


// Title Validation
  rules: {
	  'field_mla_position[und][0][value]':{
		  required:true,
		  badchar:true,
	  },
	  'field_mla_assembly[und]':{
	  	required:true,
		
	  },
	  'field_mla_cons[und]':{
	  required:true,
	  valuenotequals:'_none',
	  },
	 'field_mla_district[und]':{
		valuenotequals:'_none', 
		},
		'title' :{
			required:true,
			badchar:true,
			minlength: 5,
			maxlength: 255,
		},
		'field_mla_desig[und][0][value]':{
			badchar:true,	
		},
		'field_mla_party[und]':{
			required:true,
			valuenotequals:'_none', 
		},
		'field_mla_oparty[und][0][value]':{
		
		badchar:true,
		},
		'field_mla_place[und][0][value]':{
		badchar:true,
		},
		'field_mla_edu[und][0][value]':{
		chkbadchar:true,
		},
		'field_mla_marital[und][0][value]':{
		chkbadchar:true,
		},
		'field_mla_occu[und][0][value]':{
		chkbadchar:true,
		},
		'field_mla_career[und][0][value]':{
		chkbadchar:true,
		},
		'field_mla_other[und][0][value]':{
		chkbadchar:true,
		},
		'field_mla_cadd[und][0][value]':{
		chkbadchar:true,
		},
		'field_mla_code[und][0][value]':{
		digits:true,
		minlength:3,
		maxlength:5,
		},
		'field_mla_tele[und][0][value]':{
		digits:true,
		minlength:6,
		maxlength:8,
		},
		/*'field_mla_mobile[und][0][value]':{
		startmobilecode:true,
		digits:true,
  		},*/
		'field_mla_madd[und][0][value]':{
		chkbadchar:true,
		},
  		'field_mla_mcode[und][0][value]':{
		digits:true,
		minlength:3,
		maxlength:5,
		},
		'field_mla_mtele[und][0][value]':{
		digits:true,
		minlength:6,
		maxlength:8,
		},
		'field_mla_fcode[und][0][value]':{
		digits:true,
		minlength:3,
		maxlength:5,
		},
		'field_mla_fax[und][0][value]':{
		digits:true,
		minlength:6,
		maxlength:8,
		},
		'field_mla_email[und][0][value]':{
		email:true,
		},
		/*'field_mla_url[und][0][value]':{
		url:true,
		},*/
		'field_mla_ainfo[und][0][value]':{
		chkbadchar:true,
		},
  },
		 messages: {
		'field_mla_position[und][0][value]':{
		  required:'Select the position',
		  badchar:'Special Characters and insert, select, update, delete, drop, alter, change, modify words are not allowed' ,
		  },
		 'field_mla_assembly[und]':{
			  required:'Please Choose Assembly',
			  
		  },
		   'field_mla_cons[und]':{
	  		required:' Please Choose the Constituency Name',
			valuenotequals: 'Please Choose the Constituency Name',
	 		 },
	  		'field_mla_district[und]':{
			valuenotequals:' Please Choose the district',  
			},
			'title' :{
			required:'Enter your Name',
			badchar:'Special Characters and insert, select, update, delete, drop, alter, change, modify words are not allowed',	
			minlength: 'Minimum 5 characters should be entered',
			maxlength: 'Minimum 255 characters should be entered',
			},
			'field_mla_desig[und][0][value]':{
			badchar:'Special Characters and insert, select, update, delete, drop, alter, change, modify words are not allowed',
			},
			'field_mla_party[und]':{
			required:'Choose the party name',
			valuenotequals:'Please Choose the Party Name', 
			},
			'field_mla_oparty[und][0][value]':{
			
			badchar:'Special Characters and insert, select, update, delete, drop, alter, change, modify words are not allowed',
			},
			'field_mla_place[und][0][value]':{
			badchar:'Special Characters and insert, select, update, delete, drop, alter, change, modify words are not allowed',
			},
			'field_mla_edu[und][0][value]':{
			chkbadchar:'insert, select, update, delete, drop, alter, change, modify not allowed.',
			},
			'field_mla_marital[und][0][value]':{
			chkbadchar:'insert, select, update, delete, drop, alter, change, modify not allowed.',
			},
			'field_mla_occu[und][0][value]':{
			chkbadchar:'insert, select, update, delete, drop, alter, change, modify not allowed.',
			},
			'field_mla_career[und][0][value]':{
			chkbadchar:'insert, select, update, delete, drop, alter, change, modify not allowed.',
			},
			'field_mla_other[und][0][value]':{
			chkbadchar:'insert, select, update, delete, drop, alter, change, modify not allowed.',
			},
			'field_mla_cadd[und][0][value]':{
			chkbadchar:'insert, select, update, delete, drop, alter, change, modify not allowed.',
			},
			'field_mla_code[und][0][value]':{
		digits:'Numbers are only entered',
		minlength: 'Minimum 3 characters should be entered',
		maxlength:'Maximum 5 character only allowed',
		},
		'field_mla_tele[und][0][value]':{
		digits:'Numbers are only entered',
		minlength:'Minimum 6 characters should be entered',
		maxlength:'Maximum 8 character only allowed',
		},
		'field_mla_mobile[und][0][value]':{
		startmobilecode:'Numbers should start with 0 or 9 or 7',
		digits:'Numbers are only entered',
  		},
		'field_mla_madd[und][0][value]':{
		chkbadchar:'insert, select, update, delete, drop, alter, change, modify not allowed.',
		},
  		'field_mla_mcode[und][0][value]':{
		digits:'Numbers are only entered',
		minlength:'Minimum 3 characters should be entered',
		maxlength:'Maximum 5 character only allowed',
		},
		'field_mla_mtele[und][0][value]':{
		digits:'Numbers are only entered',
		minlength:'Minimum 6 characters should be entered',
		maxlength:'Maximum 8 character only allowed',
		},
		'field_mla_fcode[und][0][value]':{
		digits:'Numbers are only entered',
		minlength:'Minimum 3 characters should be entered',
		maxlength:'Maximum 5 character only allowed',
		},
		'field_mla_fax[und][0][value]':{
		digits:'Numbers are only entered',
		minlength:'Minimum 6 characters should be entered',
		maxlength:'Maximum 8 character only allowed',
		},
		'field_mla_email[und][0][value]':{
		email:'Invalid-email',
		},
		'field_mla_url[und][0][value]':{
		url:'Invalid URL',
		},
		'field_mla_ainfo[und][0][value]':{
		chkbadchar:'insert, select, update, delete, drop, alter, change, modify not allowed.',
		},
},
  invalidHandler: function(form, validator) {
       
       					 if (!validator.numberOfInvalids())
								return;
						else{
							
							  //district("#documents-node-form").create_errormsg_container('errormsg_container','documents-node-form');
						}
							
							mlaprofile('html, body').animate({
								scrollTop: mlaprofile(validator.errorList[0].element).offset().top - 100
							}, 1000);
							
						},
				

   
	});

});		